package top.jandmla.excel.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.jandmla.excel.bean.Test;
import top.jandmla.excel.pojo.QueryPageDTO;
import top.jandmla.excel.service.TestService;
import top.jandmla.excel.util.result.BaseResult;

@RestController
public class TestController {

    @Autowired
    private TestService testService;


    @PostMapping(value = "selectPageAndTest")
    public BaseResult<IPage<Test>> selectPageAndTest(@RequestBody QueryPageDTO<Test> dto) {
        IPage<Test> page = testService.selectPageAndTest(dto);
        return page.getRecords().size() > 0 ? BaseResult.success(page)
                : BaseResult.fail(1, "查询数据失败！");
    }
}
